/**@FILE:ExpressAction.java
 * @AUTHOR:qingsheng.zheng
 * @DATE:2015-2-1 上午11:40:17*/
package com.xf.toy.web;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.xf.pub.exception.ServiceException;
import com.xf.pub.logger.LoggerUtil;
import com.xf.toy.bean.Express;

import com.xf.toy.service.ExpressService;
import com.xf.toy.service.OrderService;
import com.xf.toy.web.common.BaseAction;

/*******************************************
 * @COMPANY:alibaba
 * @CLASS:ExpressAction
 * @DESCRIPTION:	
 * @AUTHOR:qingsheng.zheng
 * @VERSION:v1.0
 * @DATE:2015-2-1 上午11:40:17
 *******************************************/
@Controller
@RequestMapping(value = "/toy/express")
public class ExpressAction extends BaseAction {
	@Resource(name = "expressService")
	private ExpressService expressService;
	@Resource(name = "orderService")
	private OrderService orderService;
	private Long userid;
	
	@RequestMapping(value = "/create")
	public void creteExpress(@RequestParam Long orderid, 
			@RequestParam String company,
			@RequestParam String courier,
			@RequestParam String excode,
			@RequestParam String exmobile,
			
			HttpServletRequest req,
			HttpServletResponse resp) {
		try {
			userid=super.getUserId(req);
			operLogger.info(LoggerUtil.logstr("method","toy/express/create","userid",userid+""));
			Express express=new Express();
			express.setCompany(company);
			express.setCourier(courier);
			express.setExCode(excode);
			express.setExMobile(exmobile);
			expressService.createExpress(express, orderid);	
			response(resp, null);
		} catch (ServiceException e) {
			response(resp, e);
		}
	}
	

	
	
}
